/**
 * json配置举例，更多配置请看 IConfigSchema
 * @author luguoxiang
 * @date 2022/7/5
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { FilterTypeEnum, IConfigSchema, intToIp, LgBizSelect, LgBizSelectProps } from '@/soar';
import userApi from '@/pages/system/auth/user/api';
// 获取全部图标的列表

const fieldList: IConfigSchema<any>[] = [
  {
    field: 'userType',
    label: '用户类型',
    dataType: 'dict',
    params: 'user-type',
    table: {
      minWidth: 160,
      sorter: true,
    },
    search: {
      searchType: FilterTypeEnum.CUSTOM,
    },
  },
  {
    field: 'nickname',
    label: '用户昵称',
    dataType: 'string',
    table: {
      minWidth: 160,
    },
    search: {
      field: 'userId',
      searchType: FilterTypeEnum.CUSTOM,
      component: LgBizSelect,
      componentProps: {
        data: userApi.query,
        valueField: 'id',
        labelField: '${nickname}(${username})',
        search: 'nickname|username',
      } as LgBizSelectProps,
    },
  },
  {
    field: 'clientType',
    label: '终端类型',
    dataType: 'dict',
    params: 'client-type',
    table: {
      minWidth: 160,
      sorter: true,
    },
    search: {
      searchType: FilterTypeEnum.CUSTOM,
    },
  },
  {
    field: 'ip',
    label: 'IP',
    dataType: 'string',
    table: {
      minWidth: 160,
      sorter: true,
      cell: (h, { row }) => intToIp(row.ip),
    },
    search: {
      searchType: FilterTypeEnum.CUSTOM,
    },
  },
  {
    field: 'expires',
    label: '有效期',
    dataType: 'datetime',
    table: {
      minWidth: 160,
      sorter: true,
    },
    search: {
      searchType: FilterTypeEnum.CUSTOM,
    },
  },
  {
    field: 'system',
    label: '用户系统',
    dataType: 'string',
    table: {
      ellipsis: true,
    },
  },
  {
    field: 'browser',
    label: '用户浏览器',
    dataType: 'string',
    table: {
      ellipsis: true,
    },
  },
];

export default fieldList;
